import { createRouter, createWebHistory } from 'vue-router'
import Dashboard from '../views/Dashboard.vue'

const routes = [
    {
        path: '/',
        redirect: '/dashboard'
    },
    {
        path: '/dashboard',
        name: 'Dashboard',
        component: Dashboard,
        meta: { title: '系统首页' }
    },
    {
        path: '/sports/data',
        name: 'SportsData',
        component: "",
        meta: { title: '运动健康数据' }
    },
    {
        path: '/sports/plan',
        name: 'SportsPlan',
        component: '',
        meta: { title: '运动计划' }
    },
    {
        path: '/medical/consultation',
        name: 'MedicalConsultation',
        component: '',
        meta: { title: '在线问诊' }
    },
    {
        path: '/medical/report',
        name: 'MedicalReport',
        component: '',
        meta: { title: '体检报告' }
    },
    {
        path: '/mall',
        name: 'Mall',
        component: '',
        meta: { title: '商城管理' }
    },
    {
        path: '/content',
        name: 'Content',
        component: '',
        meta: { title: '内容管理' }
    },
    {
        path: '/statistics',
        name: 'Statistics',
        component: '',
        meta: { title: '数据统计' }
    },
    {
        path: '/system',
        name: 'System',
        component: '',
        meta: { title: '系统管理' }
    },
    {
        path: '/login',
        name: 'Login',
        component: import('../views/Ye/Login.vue'),
        meta: { title: '登录' }
    },
    {
        path: '/register',
        name: 'Register',
        component: import('../views/Ye/RegisterForm.vue'),
        meta: { title: '注册' }
    },
    {
        path: '/column',
        name: 'Column',
        component: import('../views/ming/column.vue'),
    },
    {
        path: '/category',
        name: 'Category',
        component: import('../views/MallManagement/Category.vue'),
        meta: { title: '品类管理' }
    },
    {
        path: '/login',
        name: 'Login',
        component: import('../views/Ye/Login.vue'),
        meta: { title: '登录' }
    },
    {
        path: '/addAndEditCategory',
        name: 'AddAndEditCategory',
        component: import('../views/MallManagement/AddAndEditCategory.vue'),
        meta: { title: '新增和修改品类' }
    },
    {
        path: '/productManagement',
        name: 'ProductManagement',
        component: import('../views/MallManagement/ProductManagement.vue'),
    },
    {
        path: '/addGoods',
        name: 'AddGoods',
        component: import('../views/MallManagement/AddGoods.vue'),
    },
    {
        path: '/viewCategory',
        name: 'ViewCategory',
        component: import('../views/MallManagement/ViewCategory.vue'),
    },
    {
        path: '/orderManagement',
        name: 'OrderManagement',
        component: import('../views/MallManagement/OrderManagement.vue'),
    },
    {
        path: '/roleList',
        name: 'RoleList',
        component: import('../views/Ye/RoleList.vue'),
        meta: { title: '注册' }
    },
    {
        path: '/getNewsType',
        name: 'GetNewsType',
        component: import('../views/ming/NewsArticle.vue'),
    },
    {
        path: '/rolePermission',
        name: 'RolePermission',
        component: import('../views/ye/RolePermission.vue'),
    },
    {
        path: '/afterSalesService',
        name: 'AfterSalesService',
        component: import('../views/MallManagement/AfterSalesService.vue'),
    },
    {
        path: '/permission',
        name: 'Permission',
        component: import('../views/ye/Permission.vue'),
    },
    {
        path: '/shippingTemplate',
        name: 'ShippingTemplate',
        component: import('../views/MallManagement/ShippingTemplate.vue'),
    },
    {
        path: '/news',
        name: 'News',
        component: import('../views/ming/news.vue')
    },
    {
        path: '/addShippingTemplate',
        name: 'AddShippingTemplate',
        component: import('../views/MallManagement/AddShippingTemplate.vue')
    },
    {
        path:'/departmentManagement',
        name:'departmentManagement',
        component:()=>import('../views/xiaoding/DepartmentManagement.vue'),
        meta:{title:'科室管理'}
    },
    {
        path:'/hospital',
        name:'hospital',
        component:()=>import('../views/xiaoding/Hospital.vue'),
        meta:{title:'医院管理'}
    },
    {
        path:'/hospitalDetail/:id',
        name:'hospitalDetail',
        component:()=>import('../views/xiaoding/HospitalDetail.vue'),
        meta:{title:'医院详情'},
        props:true
    },
    {
        path:'/addHospital',
        name:'addHospital',
        component:()=>import('../views/xiaoding/AddHospital.vue'),
        meta:{title:'添加医院'}
    },
    {
        path:'/doctor',
        name:'doctor',
        component:()=>import('../views/xiaoding/Doctor.vue'),
        meta:{title:'医生管理'}
    },
    {
        path:'/doctorDetail/:id',
        name:'doctorDetail',
        component:()=>import('../views/xiaoding/DoctorDetail.vue'),
        meta:{title:'医生详情'},
        props:true
    },
    {
        path:'/addDoctor',
        name:'addDoctor',
        component:()=>import('../views/xiaoding/AddDoctor.vue'),
        meta:{title:'添加医生'}
    },
    {
        path:'/disease',
        name:'disease',
        component:()=>import('../views/xiaoding/Disease.vue'),
        meta:{title:'疾病管理'}
    },
    {
        path:'/updateDisease/:id?',
        name:'updateDisease',
        component:()=>import('../views/xiaoding/UpdateDisease.vue'),
        meta:{title:'更新疾病/或修改疾病'},
        props: (route) => ({
            id: route.params.id ? Number(route.params.id) : null // 确保id为数字或null
        })
    },
    {
        path:'/appointmentSetting',
        name:'appointmentSetting',
        component:()=>import('../views/xiaoding/AppointmentSetting.vue'),
        meta:{title:'预约设置'}
    },
    {
        path:'/addAppointmentSetting/:id?',
        name:'addAppointmentSetting',
        component:()=>import('../views/xiaoding/AddAppointmentSetting.vue'),
        meta:{title:'添加预约设置'},
        props: (route) => ({
            id: route.params.id ? Number(route.params.id) : null // 确保id为数字或null
        })
    },
    {
        path:'/appointmentQuery',
        name:'appointmentQuery',
        component:()=>import('../views/xiaoding/AppointmentQuery.vue'),
        meta:{title:'预约挂号查询'},

    },
    {
        path:'/medicalAppointment',
        name:'medicalAppointment',
        component:()=>import('../views/xiaoding/MedicalAppointment.vue'),
        meta:{title:'预约体检查询'}
    },
    {
        path:'/appointmentDetail/:id',
        name:'appointmentDetail',
        component:()=>import('../views/xiaoding/AppointmentDetail.vue'),
        meta:{title:'预约详情'},
        props: (route) => ({
            id: route.params.id ? Number(route.params.id) : null // 确保id为数字或null
        })
    },
    {
        path:'/medicalDetail/:id',
        name:'medicalDetail',
        component:()=>import('../views/xiaoding/MedicalDetail.vue'),
        meta:{title:'体检查询详情'},
        props: (route) => ({
            id: route.params.id ? Number(route.params.id) : null // 确保id为数字或null
        })
    },
    {
        path:'/registrationOrder',
        name:'registrationOrder',
        component:()=>import('../views/ming/xiaoding/RegistrationOrder.vue'),
        meta:{title:'挂号订单'}
    },
    {
        path:'/orderDetail',
        name:'OrderDetail',
        component:()=>import('../views/MallManagement/OrderDetail.vue'),
        meta:{title:'挂号订单'}
    },
    {
        path:'/viewportmentQuery',
        name:'viewportmentQuery',
        component:()=>import('../views/xiaoding/ViewportmentQuery.vue'),
        meta:{title:'体检订单'}
    },
    {
        path:'/productStats',
        name:'ProductStats',
        component:()=>import('../views/MallManagement/ProductStats.vue'),
        meta:{title:'挂号订单'}
    },
    {
        path:'/productStats',
        name:'ProductStats',
        component:()=>import('../views/MallManagement/ProductStats.vue')},
    {
        path: '/editPreUserForm',
        name: 'EditPreUserForm',
        component: import('../views/Ye/EditPreUserForm.vue'),
        meta: { title: '修改前台用户信息' }
    },
    {
        path: '/preUserDetail',
        name: 'PreUserDetail',
        component: import('../views/Ye/PreUserDetail.vue'),
        meta: { title: '前台用户详情' }
    },
    {
        path: '/403',
        name: '403',
        component: () => import('@/views/error/403.vue')
    },
    {
        path: '/userCount',
        name: 'UserCount',
        component: import('../views/Ye/UserCount.vue'),
        meta: { title: '用户统计' }
    }
]

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes
})

export {router}